package com.board.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.board.dao.FoodMapper;
import com.board.dto.FoodDto;
import com.board.entity.Food;
import com.board.service.FoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 小叶
 * @since 2024年04月08日
 */
@Service
public class FoodServiceImpl extends ServiceImpl<FoodMapper, Food> implements FoodService {
    @Autowired
    private FoodMapper foodMapper;

    @Override
    public List<FoodDto> findFoodByIds(List<Integer> foodIds) {
        List<Food> foods = foodMapper.selectBatchIds(foodIds);
        List<FoodDto> foodDtos = BeanUtil.copyToList(foods, FoodDto.class);
        return foodDtos;
    }
}
